#include <iostream>
using namespace std;
class Resource{
private:
    string name;
public:
    Resource (const string& n):
    name(n)
    {
        cout<<"copy contructor function"<<name<<endl;
    }
    ~ Resource(){
        cout<<"delete contructor"<<name<<endl;
    }

    void use(){
        cout<<"use resource"<<name<<endl;
    }
};
    
int main(int argc, char * argv[]){
    cout<<"======goto main========="<<endl;

    cout<<"=====create local object====="<<endl;
    Resource r1("local Resource");

    cout<<"====create dynamic====="<<endl;
    Resource*r2=new Resource("dynamic Resource");
    r2->use();
    cout<<"====delete dynamic===="<<endl;
    delete r2;
    cout<<"=====code block end==="<<endl;

    cout<<"====main end===="<<endl;
    return 0;
}

